package net.xconcepts.stockdata.model.tick;

import java.util.Date;
import java.util.Hashtable;
import java.util.Map.Entry;



/**
 * Contains tick information pertaining to a specific symbol. Tick does not necessarily
 * refer to stock tick, and is only used as the minimum type of measurement. Is most
 * likely to be by minute
 * @author Steven
 *
 */
public class Tick {
	
	public final Date timeStamp;
	protected final Hashtable<TickDataField, Double> mData;
	
	public Tick(Date timeStamp, Hashtable<TickDataField, Double> data) {
		this.timeStamp = timeStamp;
		mData = data;
	}
	
	public double getData(TickDataField field) {
		return mData.get(field);
	}
	
	public String toString() {
		final String DELIM = ",";
		
		StringBuilder builder = new StringBuilder();
		
		for(Entry<TickDataField, Double> entry : mData.entrySet()) {
			builder.append(DELIM + entry.getValue());
		}
		
		
		return builder.toString();
	}
}
